cmake_minimum_required(VERSION 2.8)

project(PiInfo CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(OpenCV COMPONENTS core imgproc imgcodecs freetype videoio REQUIRED)

message(STATUS "OpenCV library status:")
message(STATUS "    version: ${OpenCV_VERSION}")
message(STATUS "    libraries: ${OpenCV_LIBS}")
message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")

include_directories(${OpenCV_INCLUDE_DIRS})

add_executable(${PROJECT_NAME} main.cpp gpio_utility.hpp gpio_utility.cpp ssd_1306_128_64.cpp ssd_1306_128_64.hpp gfx_utility.cpp gfx_utility.hpp base_display.hpp utility.cpp utility.hpp)
target_link_libraries(${PROJECT_NAME} pigpio ${OpenCV_LIBS} harfbuzz fmt)

add_custom_command(
        TARGET ${PROJECT_NAME}
        POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/font $<TARGET_FILE_DIR:${PROJECT_NAME}>
        COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/video $<TARGET_FILE_DIR:${PROJECT_NAME}>
        COMMAND chmod 0777 $<TARGET_FILE_DIR:${PROJECT_NAME}>/SourceHanSansSC.otf
)